home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.5 Applications 1999 November / SGI IRIX 6.5 Applications 1999 November.iso / dev / insight_dev.idb / usr / share / Insight / bin / eps2gif.z / eps2gif
Encoding:
Text File  |  1998-10-28  |  1.7 KB  |  55 lines

  1. #!/bin/csh -f
  2. #
  3. # eps2gif Encapsulated-PostScript-File [GIF-Output-File]
  4. #
  5. # this tool uses Impressario's PSRIP utility and several PBM-Plus tools
  6. # to convert Encapsulated PostScript files to a reasonable looking GIF image.
  7.  
  8. # verify we have a figure name specified
  9. set INFILE=$1
  10. if ( "$INFILE" == "" ) then
  11.         echo "Usage: eps2gif Encapsulated-PostScript-File [GIF-Output-File]"
  12.         exit
  13. endif
  14.  
  15. # check to see that it ends in .epd .ps, .PS, or .ai; .ps and .PS
  16. # are supported for backwards compatibility
  17. set FIGURE=`basename $INFILE`
  18. set BASE=`basename $FIGURE .eps`
  19. if ( "$BASE" == "$FIGURE" ) then
  20.     set BASE=`basename $FIGURE .ai`
  21.         if ( "$BASE" == "$FIGURE" ) then
  22.             set BASE=`basename $FIGURE .ps`
  23.                 if ( "$BASE" == "$FIGURE" ) then
  24.                     set BASE=`basename $FIGURE .PS`
  25.                         if ( "$BASE" == "$FIGURE" ) then
  26.                             echo "eps2gif: suffix must be either .eps, .ai, .ps, or .PS"
  27.                             exit
  28.                         endif
  29.                 endif
  30.         endif
  31. endif
  32.  
  33. # setup the output file
  34. set OUTFILE=$2
  35. if ( "$OUTFILE" == "" ) then
  36.     set OUTFILE=$BASE.gif
  37. endif
  38.  
  39. # see that the user has Impressario's PSRIP tool installed
  40. if ( ! -f /usr/lib/print/psrip ) then
  41.     echo "eps2gif: ERROR - you must have impr_rip.sw.impr for this to work"
  42.     exit
  43. endif
  44.  
  45. # run the psrip utility
  46. # convert tiff image to PPM
  47. # | crop the image
  48. # | convert the image to gif
  49. onintr clean_up
  50. /usr/lib/print/psrip -I /usr/lib/print/data/PSRIPprolog -S -B 8 -W 935 -H 1210 -R 110 -C rgb $1 > $BASE.rip$$
  51. $TOOLROOT/usr/share/Insight/bin/tifftopnm $BASE.rip$$ | $TOOLROOT/usr/share/Insight/bin/pnmcrop | $TOOLROOT/usr/share/Insight/bin/pnmmargin -white 10 | $TOOLROOT/usr/share/Insight/bin/ppmquant 256 | $TOOLROOT/usr/share/Insight/bin/ppmtogif > $OUTFILE
  52.  
  53. clean_up:
  54. /bin/rm $BASE.rip$$
  55.